/**
 * 工单管理
 */

const WorkOrder = {

    // 获取工单负责人【过滤掉没有分配工单的人员数据】
    getHandlerNames() {
        return this.get('/IoT/api/v3/WorkOrder/GetHandlerNames');
    },

    // 完成工单
    getWordCompleteOrder(data) {
        return this.post('/IoT/api/v3/WorkOrder/CompleteOrder?id=' + data);
    },

    // 获取测点状态
    getWordYcYxState(type, data) {
        if (type === 'c' || type === 'C') {
            return this.post('/IoT/api/v3/BA/EquipYcState', data);
        }
        return this.post('/IoT/api/v3/BA/EquipYxState', data);

    },

    // 获取人员列表
    getUserDataLists(data) {
        let datas = {
            pageNo: 1,
            pageSize: 100
        }
        return this.post('/IoT/api/v3/UserManage/GetUserDataList', datas);
    },

    // 获取所有排班人员
    getWordPersonListByPage(data) {
        return this.post('/IoT/api/v3/AlarmManage/GetPersonListByPage', data);
    },

    // 提交补充信息
    // /IoT/api/v3/WorkOrder/CreateAdditionalInfo
    getCreateAdditionalInfo(data) {
        return this.post('/IoT/api/v3/WorkOrder/CreateAdditionalInfo', data);
    },

    // 获取工单补充信息
    getAdditionalInfo(data) {
        return this.get('/IoT/api/v3/WorkOrder/GetAdditionalInfo?workOrderId=' + data + '&dateTime =' + new Date());
    },

    // 获取工单设置状态
    getGlobalOderConfig() {
        return this.get('/IoT/api/v3/WorkOrder/GetGlobalOderConfig');
    },

    // 修改工单全局配置
    updateGlobalOderConfig(data) {
        return this.post('/IoT/api/v3/WorkOrder/UpdateGlobalOderConfig', data);
    },

    // 工单设置
    // 添加或编辑排班组织
    getAddOrUpdateWOScheduleOrganization(data) {
        return this.post('/IoT/api/v3/WorkOrder/AddOrUpdateWOScheduleOrganization', data);
    },

    // 添加排班组织架构第一层级(管理员)、更新排班组织
    getAddScheduleClassificationAndUpdata(type, data) {
        if (!type) {

            // 添加
            return this.post('/IoT/api/v3/WorkOrder/AddScheduleClassification', data);
        }

        // 编辑
        return this.post('/IoT/api/v3/WorkOrder/UpdateScheduleClassification', data);

    },

    // 删除架构下所有排班组织
    getDeleteScheduleClassification(type, data) {
        if (type === 0) {

            // 删除所有组织架构---管理员
            return this.post('/IoT/api/v3/WorkOrder/DeleteScheduleClassification?name=' + data);
        } else if (type === 1) {

            // 删除指定排班组织---小组
            return this.post('/IoT/api/v3/WorkOrder/DeleteScheduleOrgnization?id=' + data);
        }

        // 删除排班组织人员---人员
        return this.post('/IoT/api/v3/WorkOrder/DeleteScheduleOrgnizationPersonnel?id=' + data.id + '&name=' + data.name);

    },

    // 获取用户名列表
    getUserNamesWord(data) {
        return this.get('/IoT/api/v3/WorkOrder/GetUserNames', data);
    },

    // 获取触发设备类型列表
    getWorkOrderTriggerClassifications(data) {
        return this.get('/IoT/api/v3/WorkOrder/GetWorkOrderTriggerClassifications', data);
    },

    // 配置工单出发设备类型分类
    getAddWorkOrderTriggerEquipClassification(data) {
        return this.post('/IoT/api/v3/WorkOrder/AddWorkOrderTriggerEquipClassification', data);
    },

    // 获取工单排班组织列表
    getWOScheduleOrganizations(data) {
        return this.get('/IoT/api/v3/WorkOrder/GetWOScheduleOrganizations', data);
    },

    // 获取区域详情下的区域cyt
    getAreaById(data) {
        if (data === 0) {
            return this.get('/IoT/api/v3/WorkOrder/GetAreaById');
        }

        // return this.get('/IoT/api/v3/workorder/GetAreaById?areaId=' + data + '&currentArea=true');
        return this.get('/IoT/api/v3/workorder/GetAreaById?areaId=' + data);

    },

    // 获取人员列表
    getAdministratorData(data) {
        return this.get('/IoT/api/v3/workorder/GetAlarmUsers', data);
    },

    // 工单---
    // 获取工单维护人员列表
    getProcessors() {
        return this.get('/IoT/api/v3/WorkOrder/GetProcessors');
    },

    // 下载工单附件
    getWorkOrderDownload(data) {
        return this.get('/IoT/api/v3/WorkOrder/Download?id=' + data.id + '&type=' + data.type);
    },

    // 获取当前登录用户权限角色
    getWorkOrderUserInfo(data) {
        return this.get('/IoT/api/v3/WorkOrder/GetWorkOrderRole', data);
    },

    // 获取各状态工单分页列表
    getWorkOrders(data) {
        return this.post('/IoT/api/v3/WorkOrder/GetWorkOrders', data);
    },

    // 获取工单基础信息
    getWorkOrderInformation(data) {
        return this.get('/IoT/api/v3/WorkOrder/GetWorkOrder?id=' + data);
    },

    // 工单误报操作
    getfalsepositive(data) {
        return this.post('/IoT/api/v3/workorder/falsepositive', data);
    },

    // 获取维护人员列表---最后待移除接口
    getHandleWorkOrderProcessors(data) {
        return this.get('/IoT/api/v3/workorder/GetPCHandleWorkOrderProcessors?id=' + data.id + '&keyword=');
    },

    // 获取维护人员列表
    getHandleWorkOrderProcessorsX(data) {
        return this.get('/IoT/api/v3/WorkOrder/GetHandleWorkOrderProcessors?id=' + data.id + '&isTransfer=' + data.isTransfer);
    },

    // 获取工单操作记录
    getWorkOrderRecords(data) {
        return this.get('/IoT/api/v3/WorkOrder/GetWorkOrderRecords?id=' + data);
    },

    // 接受工单
    getAcceptorder(data) {
        return this.post('/IoT/api/v3/workorder/acceptorder?id=' + data);
    },

    // 转单
    getTransferWorkOrder(data) {
        return this.post('/IoT/api/v3/workorder/TransferWorkOrder', data);
    },

    // 提交维护反馈完成工单
    getAddWorkOrderFeedback(data) {
        return this.getForm('/IoT/api/v3/WorkOrder/AddWorkOrderFeedback', data);
    },

    // 获取工单维护反馈
    getWorkOrderFeedbacks(data) {
        return this.get('/IoT/api/v3/WorkOrder/GetWorkOrderFeedbacks?workOrderId=' + data);
    },

    // 重启工单
    getRebootWorkOrder(data) {
        return this.post('/IoT/api/v3/WorkOrder/RebootWorkOrder?id=' + data);
    },

    // 审核通过-确认工单
    getWorkOrderConfirmed(data) {
        return this.post('/IoT/api/v3/WorkOrder/WorkOrderConfirmed', data);
    },

    // 分配工单-复选框
    getAssigned(data) {
        return this.post('/IoT/api/v3/workorder/assigned', data);
    },

    // 获取厂区
    getAllAreaList(data) {
        return this.get('/IoT/api/v3/workorder/GetAllArea', data);
    },

    // 获取指定系统类型下的设备列表
    getEquipsByEquipDetails(data) {
        return this.get('/IoT/api/v3/WorkOrder/GetEquipsByClassification?pageNo=' + data.pageNo + '&pageSize=' + data.pageSize + '&id=' + data.id + '&name=' + data.name);
    },

    // 获取全部责任人
    getWorkOrderProcessors(data) {
        return this.get('/IoT/api/v3/workorder/GetWorkOrderProcessors', data);
    },

    // 获取待完成工单接口
    getPCWorkOrders(data) {
        return this.get(`/IoT/api/v3/workorder/GetPCWorkOrders`, data);
    },

    // 获取全部工单列表
    getPCAllWorkOrders(data) {
        return this.get('/IoT/api/v3/workorder/GetPCAllWorkOrders', data);
    },

    // 批量导出
    getBatchExportWorkOrders(data) {
        return this.postBlob('/IoT/api/v3/workorder/BatchExportWorkOrders', data);
    },

    // 批量误报
    getBatchFalsePositive(data) {
        return this.post('/IoT/api/v3/workorder/BatchFalsePositive', data);
    },

    // 批量分配
    getBatchAssgined(data) {
        return this.post('/IoT/api/v3/workorder/BatchAssgined', data);
    },

    // 更新参考解决方案、补充说明
    getUpdateworkorder(data) {
        return this.post('/IoT/api/v3/workorder/updateworkorder', data);
    },

    // 获取工单告警类型
    getEquipAlarmTypes() {
        return this.get('/IoT/api/v3/workorder/GetEquipAlarmTypes');
    }
}

export default WorkOrder;